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