root/trunk/locker-bin/macathenaDist.py

Revision 19, 1.5 kB (checked in by broder, 16 years ago)

macathenaDist does date-based checkouts instead of revision based checkouts

This way if we want to specify a particular timestamp to use, we can do that

  • Property svn:executable set to *
Line 
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
41 if __name__ == '__main__':
42         import sys
43        
44         for arg in sys.argv[1:]:
45                 if modules.has_key(arg):
46                         apply(packageCvs, [arg] + modules[arg])
47                 else:
48                         print "Sorry - I don't know about the module %s" % arg
Note: See TracBrowser for help on using the browser.