source: trunk/scripts/git-migration/rules.mako @ 1944

Last change on this file since 1944 was 1944, checked in by price, 16 years ago

rules.mako: indent control flow

File size: 6.7 KB
Line 
1<%
2    packages = [line.strip() for line in open('package-list')]
3    repos = packages
4    packages = [package[len('packages/'):] for package in packages]
5
6    scripts = ['git-migration', 'invirt.mit.edu', 'munin', 'prod-migration']
7    repos += ['scripts/%s' % script for script in scripts]
8
9    repos += ['doc/xvm', 'scripts/osx-update']
10
11    doubled_packages = {
12        'sipb-xen-guest-installer': (310, 310),
13        'sipb-xen-base': (314, 315),
14        'sipb-xen-database': (311, 313),
15        'sipb-xen-dev': (314, 315),
16        'sipb-xen-dom0': (314, 315),
17        'sipb-xen-remctl-auto': (314, 315),
18    }
19
20    punt = {
21        'xvm-console-devconfig': 700,
22        'sipb-xen-guest-installer': 742,
23        'sipb-xen-remote-server': 1176,
24        'sipb-xen-dns': 1184,
25        'sipb-xen-console-server': 1187,
26        'sipb-xen-console': 1201,
27        'sipb-xen-base': 1350,
28        'sipb-xen-chrony-config': 1351,
29        'sipb-xen-database': 1352,
30        'sipb-xen-dev': 1353,
31        'sipb-xen-dom0': 1354,
32        'sipb-xen-host-master': 1355,
33        'sipb-xen-iptables': 1356,
34        'sipb-xen-python-pydhcplib': 1357,
35        'sipb-xen-remctl-auto': 1358,
36        'sipb-xen-vnc-client': 1359,
37        'sipb-xen-www': 1360,
38        'sipb-xen-vnc-server': 1387,
39        'sipb-xen-dhcp': 1436,
40        'sipb-xen-autoinstaller': 1569,
41        'sipb-xen-clvm-config': 1569,
42        'invirt-console-host': 1815,
43        'invirt-console-server': 1813,
44        'invirt-remote-host': 1822,
45        'invirt-remote-server': 1822,
46    }
47
48    quashes = [
49        ('/package_tags/sipb-xen-dev/sipb-xen-dev/', 11),
50        ('/package_tags/sipb-xen-dev/13/', 316),
51        ('/package_tags/sipb-xen-console/2/', 347),
52        ('/package_tags/sipb-xen-console/2/sipb-xen-console/', 348),
53        ('/package_tags/sipb-xen-console/2/', 349),
54        ('/package_tags/sipb-xen-console/7.1/sipb-xen-console/', 401),
55        ('/package_tags/sipb-xen-guest-installer/1.0/sipb-xen-guest-installer/', 452),
56        ('/package_tags/sipb-xen-dev/14/sipb-xen-dev/', 462),
57        ('/package_tags/sipb-xen-dev/14/', 463),
58        ('/trunk/packages/sipb-xen-autoinstaller/', 742),
59        ('/trunk/packages/invirt-console-server/', 1201),
60        ('/trunk/packages/xvm-prodconfig/', 1455),
61        ('/trunk/packages/invirt-xen-config/', 1757),
62        ('/trunk/packages/invirt-console/', 1819),
63        ('/trunk/scripts/prod-migration/', 1864),
64        ('/trunk/packages/invirt-dhcp/', 1904),
65    ]
66
67    merges = []
68    for line in open('merges'):
69        line = line.strip()
70        if line == '' or line[0] == '#':
71            continue
72
73        merges.append(line.split())
74
75    merge_map = {}
76    merge_count = {}
77    merge_n = {}
78    for merge in merges:
79        repos.remove('packages/%s' % merge[0])
80        merge_map[merge[0]] = merge[1]
81        if int(merge[2]) == 0:
82            merge_count[merge[1]] = merge_count.get(merge[1], 0) + 1
83        else:
84            merge_n[merge[0]] = int(merge[2])
85
86    def get_repo(package):
87        if package in merge_map:
88            return get_repo(merge_map[package])
89        return 'packages/%s.git' % package
90
91    def get_branch(package):
92        if package in merge_map:
93            if package in merge_n or merge_count[merge_map[package]] > 1:
94                return package
95            return get_branch(merge_map[package])
96        return 'master'
97
98    def get_tag_prefix(package):
99        if package in merge_map:
100            return '%s/' % package
101        return ''
102%>
103
104% for repo in repos:
105create repository ${repo}.git
106end repository
107
108% endfor
109
110% for quash in quashes:
111match ${quash[0]}
112  min revision ${quash[1]}
113  max revision ${quash[1]}
114end match
115% endfor
116
117% for package in packages:
118
119%   if package == 'sipb-xen-database':
120match /trunk/packages/${package}/${package}-0/
121  repository ${get_repo(package)}
122  branch ${get_branch(package)}
123  max revision 8
124end match
125%   endif
126
127%   if package in doubled_packages:
128match /trunk/packages/${package}/${package}/
129  repository ${get_repo(package)}
130  branch ${get_branch(package)}
131  max revision ${doubled_packages[package][0] - 1}
132end match
133
134match /package_tags/${package}/([^/~]+)/${package}/
135  repository ${get_repo(package)}
136  branch tags/${get_tag_prefix(package)}\1
137%     if package == 'sipb-xen-dev':
138  max revision 318
139%     else:
140  max revision ${doubled_packages[package][0] - 1}
141%     endif
142end match
143
144match /trunk/packages/tmp/${package}/
145  min revision ${doubled_packages[package][0]}
146  max revision ${doubled_packages[package][0]}
147end match
148
149match /trunk/packages/${package}/
150  min revision ${doubled_packages[package][1]}
151  max revision ${doubled_packages[package][1]}
152end match
153%   endif
154
155match /trunk/packages/${package}/
156  repository ${get_repo(package)}
157  branch ${get_branch(package)}
158%   if package in doubled_packages:
159  min revision ${doubled_packages[package][1] + 1}
160%   endif
161%   if package in punt:
162  max revision ${punt[package] - 1}
163%   endif
164end match
165
166match /package_tags/${package}/([^/~]+)/
167  repository ${get_repo(package)}
168  branch tags/${get_tag_prefix(package)}\1
169%   if package in doubled_packages:
170  min revision ${doubled_packages[package][1]}
171%   endif
172end match
173
174match /package_tags/${package}/([^/~]+)~([^/~]+)/
175  repository ${get_repo(package)}
176  branch tags/${get_tag_prefix(package)}\1_\2
177%   if package in doubled_packages:
178  min revision ${doubled_packages[package][1]}
179%   endif
180end match
181
182% endfor
183
184match /trunk/packages/(xen-common|xen-3.1)/
185end match
186
187match /package_tags/(xen-common|xen-3.1)/
188end match
189
190match /trunk/dhcp/
191  repository ${get_repo('sipb-xen-dhcp')}
192  branch ${get_branch('sipb-xen-dhcp')}
193  max revision 281
194end match
195
196match /trunk/web(/|$)
197  repository ${get_repo('sipb-xen-www')}
198  branch ${get_branch('sipb-xen-www')}
199  max revision 303
200end match
201
202match /trunk/vnc/tightvnc-1.3.9_javasrc.zip
203end match
204
205match /trunk/vnc/vnc_javasrc/
206  repository ${get_repo('sipb-xen-vnc-client')}
207  branch ${get_branch('sipb-xen-vnc-client')}
208  max revision 304
209end match
210
211match /trunk/vnc/vnc_server(/|$)
212  repository ${get_repo('sipb-xen-vnc-server')}
213  branch ${get_branch('sipb-xen-vnc-server')}
214  max revision 286
215end match
216
217match /trunk/dns/
218  repository ${get_repo('sipb-xen-dns')}
219  branch dns
220  max revision 268
221end match
222
223% for script in scripts:
224match /trunk/scripts/${script}/
225  repository scripts/${script}.git
226  branch master
227end match
228% endfor
229
230match /trunk/scripts/
231  repository scripts/osx-update.git
232  branch master
233  min revision 1785
234  max revision 1785
235end match
236
237match /trunk/scripts/
238  repository scripts/prod-migration.git
239  branch master
240  max revision 1863
241end match
242
243% for rev in [803, 804, 925, 926, 928, 1537, 1566]:
244match /trunk/
245  repository doc/xvm.git
246  branch master
247  min revision ${rev}
248  max revision ${rev}
249end match
250% endfor
251
252match /trunk/vmctl/
253end match
254
255match /trunk/COPYING$
256end match
257
258match /branches/wsgi/
259end match
Note: See TracBrowser for help on using the repository browser.