Changeset 1945 for trunk/scripts
- Timestamp:
- Dec 29, 2008, 3:55:59 AM (16 years ago)
- Location:
- trunk/scripts/git-migration
- Files:
-
- 1 added
- 2 deleted
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/scripts/git-migration/rules.mako
r1944 r1945 1 1 <% 2 packages = [line.strip() for line in open('package-list')] 3 repos = packages 4 packages = [package[len('packages/'):] for package in packages] 2 import yaml 3 svn = yaml.load(open('svn.yml')) 4 packages = svn['packages'] 5 scripts = svn['scripts'] 6 quashes = svn['quashes'] 5 7 6 scripts = ['git-migration', 'invirt.mit.edu', 'munin', 'prod-migration']8 repos = ['packages/%s' % package for package in packages] 7 9 repos += ['scripts/%s' % script for script in scripts] 8 9 10 repos += ['doc/xvm', 'scripts/osx-update'] 10 11 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]) 12 for package in packages: 13 if 'merge' in packages[package]: 14 repos.remove('packages/%s' % package) 85 15 86 16 def get_repo(package): 87 if package in merge_map:88 return get_repo( merge_map[package])17 if 'merge' in packages[package]: 18 return get_repo(packages[package]['merge']) 89 19 return 'packages/%s.git' % package 90 20 91 21 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 package95 return get_branch( merge_map[package])22 if 'branch' in packages[package]: 23 return packages[package]['branch'] 24 if 'merge' in packages[package]: 25 return get_branch(packages[package]['merge']) 96 26 return 'master' 97 27 98 28 def get_tag_prefix(package): 99 if package in merge_map:29 if 'merge' in packages[package]: 100 30 return '%s/' % package 101 31 return '' … … 109 39 110 40 % for quash in quashes: 111 match ${quash[ 0]}112 min revision ${quash[ 1]}113 max revision ${quash[ 1]}41 match ${quash['path']} 42 min revision ${quash['rev']} 43 max revision ${quash['rev']} 114 44 end match 115 45 % endfor … … 125 55 % endif 126 56 127 % if package in doubled_packages:57 % if 'undouble' in packages[package]: 128 58 match /trunk/packages/${package}/${package}/ 129 59 repository ${get_repo(package)} 130 60 branch ${get_branch(package)} 131 max revision ${ doubled_packages[package][0] - 1}61 max revision ${packages[package]['undouble'][0] - 1} 132 62 end match 133 63 … … 138 68 max revision 318 139 69 % else: 140 max revision ${ doubled_packages[package][0] - 1}70 max revision ${packages[package]['undouble'][0] - 1} 141 71 % endif 142 72 end match 143 73 144 74 match /trunk/packages/tmp/${package}/ 145 min revision ${ doubled_packages[package][0]}146 max revision ${ doubled_packages[package][0]}75 min revision ${packages[package]['undouble'][0]} 76 max revision ${packages[package]['undouble'][0]} 147 77 end match 148 78 149 79 match /trunk/packages/${package}/ 150 min revision ${ doubled_packages[package][1]}151 max revision ${ doubled_packages[package][1]}80 min revision ${packages[package]['undouble'][1]} 81 max revision ${packages[package]['undouble'][1]} 152 82 end match 153 83 % endif … … 156 86 repository ${get_repo(package)} 157 87 branch ${get_branch(package)} 158 % if package in doubled_packages:159 min revision ${ doubled_packages[package][1] + 1}88 % if 'undouble' in packages[package]: 89 min revision ${packages[package]['undouble'][1] + 1} 160 90 % endif 161 % if package in punt:162 max revision ${p unt[package] - 1}91 % if 'punt' in packages[package]: 92 max revision ${packages[package]['punt'] - 1} 163 93 % endif 164 94 end match … … 167 97 repository ${get_repo(package)} 168 98 branch tags/${get_tag_prefix(package)}\1 169 % if package in doubled_packages:170 min revision ${ doubled_packages[package][1]}99 % if 'undouble' in packages[package]: 100 min revision ${packages[package]['undouble'][1]} 171 101 % endif 172 102 end match … … 175 105 repository ${get_repo(package)} 176 106 branch tags/${get_tag_prefix(package)}\1_\2 177 % if package in doubled_packages:178 min revision ${ doubled_packages[package][1]}107 % if 'undouble' in packages[package]: 108 min revision ${packages[package]['undouble'][1]} 179 109 % endif 180 110 end match
Note: See TracChangeset
for help on using the changeset viewer.