1 |
#!/usr/bin/env python |
---|
2 |
|
---|
3 |
def packageCvs(module, cvsModule, cvsroot='/afs/dev.mit.edu/source/repository', getAutoconf='packs/build/autoconf', 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 getAutoconf: |
---|
16 |
os.system('cvs -R export -r HEAD -d %s %s >/dev/null 2>/dev/null' % (cvsModule, getAutoconf)) |
---|
17 |
|
---|
18 |
stamp = 0 |
---|
19 |
for root, dirs, files in os.walk(cvsModule): |
---|
20 |
if len(files) > 0: |
---|
21 |
stamp = max(stamp, max(os.stat('%s/%s' % (root, file))[8] for file in files)) |
---|
22 |
|
---|
23 |
tarball_time = time.strftime('%Y%m%d', time.localtime(stamp)) |
---|
24 |
tarball = '%s-%s' % (module, tarball_time) |
---|
25 |
os.rename(cvsModule, tarball) |
---|
26 |
|
---|
27 |
tar = tarfile.open('%s.tar.gz' % tarball, 'w:gz') |
---|
28 |
tar.add(tarball) |
---|
29 |
tar.close() |
---|
30 |
|
---|
31 |
shutil.move('%s.tar.gz' % tarball, '/mit/macathena/dist/') |
---|
32 |
shutil.rmtree('/mit/macathena/build/%s' % tarball) |
---|
33 |
|
---|
34 |
print 'Created /mit/macathena/dist/%s.tar.gz' % tarball |
---|
35 |
|
---|
36 |
modules = {'moira': ['moira', '/afs/athena.mit.edu/astaff/project/moiradev/repository', False], |
---|
37 |
'libathdir': ['athena/lib/athdir'], |
---|
38 |
'athdir': ['athena/bin/athdir'], |
---|
39 |
'machtype': ['athena/bin/machtype'], |
---|
40 |
'attachandrun': ['athena/bin/attachandrun'], |
---|
41 |
'athrun': ['athena/bin/athrun'], |
---|
42 |
'athinfo': ['athena/bin/athinfo'], |
---|
43 |
'getcluster': ['athena/bin/getcluster']} |
---|
44 |
|
---|
45 |
if __name__ == '__main__': |
---|
46 |
import sys |
---|
47 |
|
---|
48 |
for arg in sys.argv[1:]: |
---|
49 |
if modules.has_key(arg): |
---|
50 |
apply(packageCvs, [arg] + modules[arg]) |
---|
51 |
else: |
---|
52 |
print "Sorry - I don't know about the module %s" % arg |
---|