.gitignore
[invirt/scripts/git-migration.git] / rules.mako
index 5e44a4f..0557dd3 100644 (file)
 <%
-    packages = [line.strip() for line in open('package-list')]
-    packages.append('packages/xvm-console-devconfig')
-    repos = packages
-    packages = [package[len('packages/'):] for package in packages]
-
-    scripts = ['git-migration', 'invirt.mit.edu', 'munin', 'prod-migration']
+    import yaml
+    svn = yaml.load(open('svn.yml'))
+    packages = svn['packages']
+    trunks = svn['trunks']
+    scripts = svn['scripts']
+    third = svn['third']
+    quashes = svn['quashes']
+
+    repos = ['packages/%s' % package for package in packages]
     repos += ['scripts/%s' % script for script in scripts]
+    repos += ['doc/xvm', 'scripts/osx-update', 'scripts/install-invirt']
+    repos += ['third/%s' % t for t in third]
 
-    repos += ['doc/xvm', 'scripts/osx-update']
-
-    doubled_packages = {
-        'sipb-xen-guest-installer': (310, 310),
-        'sipb-xen-base': (314, 315),
-        'sipb-xen-database': (311, 313),
-        'sipb-xen-dev': (314, 315),
-        'sipb-xen-dom0': (314, 315),
-        'sipb-xen-remctl-auto': (314, 315),
-    }
-
-    punt = {
-        'xvm-console-devconfig': 700,
-        'sipb-xen-guest-installer': 742,
-        'sipb-xen-remote-server': 1176,
-        'sipb-xen-dns': 1184,
-        'sipb-xen-console-server': 1187,
-        'sipb-xen-console': 1201,
-        'sipb-xen-base': 1350,
-        'sipb-xen-chrony-config': 1351,
-        'sipb-xen-database': 1352,
-        'sipb-xen-dev': 1353,
-        'sipb-xen-dom0': 1354,
-        'sipb-xen-host-master': 1355,
-        'sipb-xen-iptables': 1356,
-        'sipb-xen-python-pydhcplib': 1357,
-        'sipb-xen-remctl-auto': 1358,
-        'sipb-xen-vnc-client': 1359,
-        'sipb-xen-www': 1360,
-        'sipb-xen-vnc-server': 1387,
-        'sipb-xen-dhcp': 1436,
-        'sipb-xen-autoinstaller': 1569,
-        'sipb-xen-clvm-config': 1569,
-        'invirt-console-host': 1815,
-        'invirt-console-server': 1813,
-        'invirt-remote-host': 1822,
-        'invirt-remote-server': 1822,
-    }
-
-    quashes = [
-        ('/package_tags/sipb-xen-dev/sipb-xen-dev/', 11),
-        ('/package_tags/sipb-xen-dev/13/', 316),
-        ('/package_tags/sipb-xen-console/2/', 347),
-        ('/package_tags/sipb-xen-console/2/sipb-xen-console/', 348),
-        ('/package_tags/sipb-xen-console/2/', 349),
-        ('/package_tags/sipb-xen-console/7.1/sipb-xen-console/', 401),
-        ('/package_tags/sipb-xen-guest-installer/1.0/sipb-xen-guest-installer/', 452),
-        ('/package_tags/sipb-xen-dev/14/sipb-xen-dev/', 462),
-        ('/package_tags/sipb-xen-dev/14/', 463),
-        ('/trunk/packages/sipb-xen-autoinstaller/', 742),
-        ('/trunk/packages/invirt-console-server/', 1201),
-        ('/trunk/packages/xvm-prodconfig/', 1455),
-        ('/trunk/packages/invirt-xen-config/', 1757),
-        ('/trunk/packages/invirt-console/', 1819),
-        ('/trunk/scripts/prod-migration/', 1864),
-        ('/trunk/packages/invirt-dhcp/', 1904),
-    ]
-
-    merges = []
-    for line in open('merges'):
-        line = line.strip()
-        if line == '' or line[0] == '#':
-            continue
-
-        merges.append(line.split())
-
-    merge_map = {}
-    merge_count = {}
-    merge_n = {}
-    for merge in merges:
-        repos.remove('packages/%s' % merge[0])
-        merge_map[merge[0]] = merge[1]
-        if int(merge[2]) == 0:
-            merge_count[merge[1]] = merge_count.get(merge[1], 0) + 1
-        else:
-            merge_n[merge[0]] = int(merge[2])
+    for package in packages:
+        if 'merge' in packages[package]:
+            repos.remove('packages/%s' % package)
 
     def get_repo(package):
-        if package in merge_map:
-            return get_repo(merge_map[package])
+        if 'merge' in packages[package]:
+            return get_repo(packages[package]['merge'])
         return 'packages/%s.git' % package
 
     def get_branch(package):
-        if package in merge_map:
-            if package in merge_n or merge_count[merge_map[package]] > 1:
-                return package
-            return get_branch(merge_map[package])
+        if 'branch' in packages[package]:
+            return packages[package]['branch']
+        if 'merge' in packages[package]:
+            return get_branch(packages[package]['merge'])
         return 'master'
 
     def get_tag_prefix(package):
-        if package in merge_map:
+        if 'merge' in packages[package]:
             return '%s/' % package
         return ''
 %>
@@ -109,75 +41,71 @@ end repository
 % endfor
 
 % for quash in quashes:
-match ${quash[0]}
-  min revision ${quash[1]}
-  max revision ${quash[1]}
+match ${quash['path']}
+  min revision ${quash['rev']}
+  max revision ${quash['rev']}
 end match
 % endfor
 
 % for package in packages:
 
-% if package == 'sipb-xen-database':
+%   if package == 'sipb-xen-database':
 match /trunk/packages/${package}/${package}-0/
   repository ${get_repo(package)}
   branch ${get_branch(package)}
   max revision 8
 end match
-% endif
+%   endif
 
-% if package in doubled_packages:
+%   if 'undouble' in packages[package]:
 match /trunk/packages/${package}/${package}/
   repository ${get_repo(package)}
   branch ${get_branch(package)}
-  max revision ${doubled_packages[package][0] - 1}
+  max revision ${packages[package]['undouble'][0] - 1}
 end match
 
 match /package_tags/${package}/([^/~]+)/${package}/
   repository ${get_repo(package)}
   branch tags/${get_tag_prefix(package)}\1
-% if package == 'sipb-xen-dev':
-  max revision 318
-% else:
-  max revision ${doubled_packages[package][0] - 1}
-% endif
+  max revision ${packages[package]['undouble'][0] - 1}
 end match
 
 match /trunk/packages/tmp/${package}/
-  min revision ${doubled_packages[package][0]}
-  max revision ${doubled_packages[package][0]}
+  min revision ${packages[package]['undouble'][0]}
+  max revision ${packages[package]['undouble'][0]}
 end match
 
 match /trunk/packages/${package}/
-  min revision ${doubled_packages[package][1]}
-  max revision ${doubled_packages[package][1]}
+  min revision ${packages[package]['undouble'][1]}
+  max revision ${packages[package]['undouble'][1]}
 end match
-% endif
+%   endif
 
 match /trunk/packages/${package}/
   repository ${get_repo(package)}
   branch ${get_branch(package)}
-% if package in doubled_packages:
-  min revision ${doubled_packages[package][1] + 1}
-% endif
-% if package in punt:
-  max revision ${punt[package] - 1}
-% endif
+%   if 'undouble' in packages[package]:
+  min revision ${packages[package]['undouble'][1] + 1}
+%   endif
+%   if 'punt' in packages[package]:
+  max revision ${packages[package]['punt'] - 1}
+%   endif
 end match
 
 match /package_tags/${package}/([^/~]+)/
   repository ${get_repo(package)}
   branch tags/${get_tag_prefix(package)}\1
-% if package in doubled_packages:
-  min revision ${doubled_packages[package][1]}
-% endif
+%   if 'undouble' in packages[package]:
+  min revision ${packages[package]['undouble'][1]}
+%   endif
 end match
 
 match /package_tags/${package}/([^/~]+)~([^/~]+)/
   repository ${get_repo(package)}
   branch tags/${get_tag_prefix(package)}\1_\2
-% if package in doubled_packages:
-  min revision ${doubled_packages[package][1]}
-% endif
+%   if 'undouble' in packages[package]:
+  min revision ${packages[package]['undouble'][1]}
+%   endif
 end match
 
 % endfor
@@ -188,39 +116,29 @@ end match
 match /package_tags/(xen-common|xen-3.1)/
 end match
 
-match /trunk/dhcp/
-  repository ${get_repo('sipb-xen-dhcp')}
-  branch ${get_branch('sipb-xen-dhcp')}
-  max revision 281
-end match
-
-match /trunk/web(/|$)
-  repository ${get_repo('sipb-xen-www')}
-  branch ${get_branch('sipb-xen-www')}
-  max revision 303
+% for trunk in trunks:
+%   if 'inclusive' in trunks[trunk]:
+match /trunk/${trunk}(/|$)
+%   else:
+match /trunk/${trunk}/
+%   endif
+  repository ${get_repo(trunks[trunk]['merge'])}
+%   if 'branch' in trunks[trunk]:
+  branch ${trunks[trunk]['branch']}
+%   else:
+  branch ${get_branch(trunks[trunk]['merge'])}
+%   endif
+%   if 'inclusive' in trunks[trunk]:
+  max revision ${trunks[trunk]['punt']}
+%   else:
+  max revision ${trunks[trunk]['punt'] - 1}
+%   endif
 end match
+% endfor
 
 match /trunk/vnc/tightvnc-1.3.9_javasrc.zip
 end match
 
-match /trunk/vnc/vnc_javasrc/
-  repository ${get_repo('sipb-xen-vnc-client')}
-  branch ${get_branch('sipb-xen-vnc-client')}
-  max revision 304
-end match
-
-match /trunk/vnc/vnc_server(/|$)
-  repository ${get_repo('sipb-xen-vnc-server')}
-  branch ${get_branch('sipb-xen-vnc-server')}
-  max revision 286
-end match
-
-match /trunk/dns/
-  repository ${get_repo('sipb-xen-dns')}
-  branch dns
-  max revision 268
-end match
-
 % for script in scripts:
 match /trunk/scripts/${script}/
   repository scripts/${script}.git
@@ -236,11 +154,30 @@ match /trunk/scripts/
 end match
 
 match /trunk/scripts/
+  repository scripts/install-invirt.git
+  branch master
+  min revision 2026
+  max revision 2026
+end match
+
+match /trunk/scripts/
   repository scripts/prod-migration.git
   branch master
   max revision 1863
 end match
 
+% for t in third:
+match /trunk/third/${t}/
+  repository third/${t}.git
+  branch master
+end match
+
+match /third_tags/${t}/([^/~]+)/
+  repository third/${t}.git
+  branch tags/\1
+end match
+% endfor
+
 % for rev in [803, 804, 925, 926, 928, 1537, 1566]:
 match /trunk/
   repository doc/xvm.git