~jderose/+junk/scripts

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/python3

import sys
import os
from os import path
from subprocess import check_call

components = (
    'novacut',
    'dmedia',
    'filestore',
    'userwebkit',
    'dbase32',
    'microfiber',
    'usercouch',
)

if len(sys.argv) > 1:
    base = path.abspath(sys.argv[1])
else:
    base = os.getcwd()
if not path.isdir(base):
    print('not a directory: {!r}'.format(base))
    sys.exit(1)
print('Creating repos in {!r}'.format(base))

for name in components:
    print('')
    repo = path.join(base, name)
    trunk = path.join(base, name, 'trunk')
    if path.exists(repo):
        print('Already exists: {!r}'.format(repo))
        continue
    check_call(['/usr/bin/bzr', 'init-repo', repo])
    check_call(['/usr/bin/bzr', 'checkout', 'lp:{}'.format(name), trunk])