1 |
#!/usr/bin/env python |
---|
2 |
|
---|
3 |
def packageCvs(module, cvsModule, extras=['packs/build/autoconf'], cvsroot='/afs/dev.mit.edu/source/repository', date='tomorrow'): |
---|
4 |
import os |
---|
5 |
import time |
---|
6 |
import tarfile |
---|
7 |
import shutil |
---|
8 |
|
---|
9 |
os.system('attach macathena >/dev/null 2>/dev/null') |
---|
10 |
os.chdir('/mit/macathena/build') |
---|
11 |
|
---|
12 |
os.environ['CVSROOT'] = cvsroot |
---|
13 |
os.system('cvs -R export -D %s %s >/dev/null 2>/dev/null' % (date, cvsModule)) |
---|
14 |
|
---|
15 |
if extras: |
---|
16 |
for extra in extras: |
---|
17 |
os.system('cvs -R export -D %s -d %s %s >/dev/null 2>/dev/null' % (date, cvsModule, extra)) |
---|
18 |
|
---|
19 |
stamp = 0 |
---|
20 |
for root, dirs, files in os.walk(cvsModule): |
---|
21 |
if len(files) > 0: |
---|
22 |
stamp = max(stamp, max(os.stat('%s/%s' % (root, file))[8] for file in files)) |
---|
23 |
|
---|
24 |
tarball_time = time.strftime('%Y%m%d', time.localtime(stamp)) |
---|
25 |
tarball = '%s-%s' % (module, tarball_time) |
---|
26 |
os.rename(cvsModule, tarball) |
---|
27 |
|
---|
28 |
tar = tarfile.open('%s.tar.gz' % tarball, 'w:gz') |
---|
29 |
tar.add(tarball) |
---|
30 |
tar.close() |
---|
31 |
|
---|
32 |
shutil.move('%s.tar.gz' % tarball, '/mit/macathena/dist/') |
---|
33 |
shutil.rmtree('/mit/macathena/build/%s' % tarball) |
---|
34 |
|
---|
35 |
print 'Created /mit/macathena/dist/%s.tar.gz' % tarball |
---|
36 |
|
---|
37 |
modules = {'moira': ['moira', False, '/afs/athena.mit.edu/astaff/project/moiradev/repository'], |
---|
38 |
'libathdir': ['athena/lib/athdir'], |
---|
39 |
'athdir': ['athena/bin/athdir'], |
---|
40 |
'machtype': ['athena/bin/machtype'], |
---|
41 |
'attachandrun': ['athena/bin/attachandrun'], |
---|
42 |
'athrun': ['athena/bin/athrun'], |
---|
43 |
'athinfo': ['athena/bin/athinfo'], |
---|
44 |
'getcluster': ['athena/bin/getcluster', ['packs/build/autoconf', 'packs/build/aclocal.m4']], |
---|
45 |
'libxj': ['athena/lib/Xj'], |
---|
46 |
'libss': ['athena/lib/ss'], |
---|
47 |
'xcluster': ['athena/bin/xcluster'], |
---|
48 |
'discuss': ['athena/bin/discuss']} |
---|
49 |
|
---|
50 |
if __name__ == '__main__': |
---|
51 |
import sys |
---|
52 |
|
---|
53 |
for arg in sys.argv[1:]: |
---|
54 |
if modules.has_key(arg): |
---|
55 |
apply(packageCvs, [arg] + modules[arg]) |
---|
56 |
else: |
---|
57 |
print "Sorry - I don't know about the module %s" % arg |
---|