Changeset 1945 for trunk/scripts


Ignore:
Timestamp:
Dec 29, 2008, 3:55:59 AM (16 years ago)
Author:
andersk
Message:

Move lots of information to a YAML database.

Location:
trunk/scripts/git-migration
Files:
1 added
2 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/scripts/git-migration/rules.mako

    r1944 r1945  
    11<%
    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']
    57
    6     scripts = ['git-migration', 'invirt.mit.edu', 'munin', 'prod-migration']
     8    repos = ['packages/%s' % package for package in packages]
    79    repos += ['scripts/%s' % script for script in scripts]
    8 
    910    repos += ['doc/xvm', 'scripts/osx-update']
    1011
    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)
    8515
    8616    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'])
    8919        return 'packages/%s.git' % package
    9020
    9121    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])
     22        if 'branch' in packages[package]:
     23            return packages[package]['branch']
     24        if 'merge' in packages[package]:
     25            return get_branch(packages[package]['merge'])
    9626        return 'master'
    9727
    9828    def get_tag_prefix(package):
    99         if package in merge_map:
     29        if 'merge' in packages[package]:
    10030            return '%s/' % package
    10131        return ''
     
    10939
    11040% for quash in quashes:
    111 match ${quash[0]}
    112   min revision ${quash[1]}
    113   max revision ${quash[1]}
     41match ${quash['path']}
     42  min revision ${quash['rev']}
     43  max revision ${quash['rev']}
    11444end match
    11545% endfor
     
    12555%   endif
    12656
    127 %   if package in doubled_packages:
     57%   if 'undouble' in packages[package]:
    12858match /trunk/packages/${package}/${package}/
    12959  repository ${get_repo(package)}
    13060  branch ${get_branch(package)}
    131   max revision ${doubled_packages[package][0] - 1}
     61  max revision ${packages[package]['undouble'][0] - 1}
    13262end match
    13363
     
    13868  max revision 318
    13969%     else:
    140   max revision ${doubled_packages[package][0] - 1}
     70  max revision ${packages[package]['undouble'][0] - 1}
    14171%     endif
    14272end match
    14373
    14474match /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]}
    14777end match
    14878
    14979match /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]}
    15282end match
    15383%   endif
     
    15686  repository ${get_repo(package)}
    15787  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}
    16090%   endif
    161 %   if package in punt:
    162   max revision ${punt[package] - 1}
     91%   if 'punt' in packages[package]:
     92  max revision ${packages[package]['punt'] - 1}
    16393%   endif
    16494end match
     
    16797  repository ${get_repo(package)}
    16898  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]}
    171101%   endif
    172102end match
     
    175105  repository ${get_repo(package)}
    176106  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]}
    179109%   endif
    180110end match
Note: See TracChangeset for help on using the changeset viewer.