root/trunk/locker-bin/macathenaDist.py

Revision 5, 1.4 kB (checked in by broder, 17 years ago)

Checksumming function to get the md5, sha1, and rmd160 checksums that usually come with Portfiles.

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