Index: trunk/locker-bin/macathenaDist.py =================================================================== --- trunk/locker-bin/macathenaDist.py (revision 35) +++ trunk/locker-bin/macathenaDist.py (revision 46) @@ -3,6 +3,9 @@ import tarfile import os +from os.path import basename import time import shutil + +mtime = 0 class MyTarFile(tarfile.TarFile): @@ -14,7 +17,38 @@ if info.isdir(): - info.mtime = 0 + info.mtime = mtime return info + +def packageSvn(module, svnModule, extras=[], svnroot='/afs/dev.mit.edu/source/svn-repos', revision='HEAD'): + os.system('attach macathena >/dev/null 2>/dev/null') + os.chdir('/mit/macathena/build') + + os.system('svn export -r %s file://%s/%s %s >/dev/null 2>&1' % (revision, svnroot, svnModule, module)) + + for extra in extras: + os.system('svn export -r %s file://%s/%s >/dev/null 2>&1' % (revision, svnroot, extra)) + os.system('mv %s %s' % (basename(extra), module)) + + version_info = os.popen('svn info -r %s file://%s/%s' % (revision, svnroot, svnModule)).readlines() + for line in version_info: + if line.startswith('Last Changed Date: '): + time_string = line.strip().split(': ')[1][0:19] + elif line.startswith('Last Changed Rev: '): + revision = line.strip().split(': ')[1] + + mtime = int(time.strftime("%s", time.strptime(time_string, "%Y-%m-%d %H:%M:%S"))) + + tarball = "%s-%s" % (module, revision) + os.rename(module, tarball) + + tar = MyTarFile.open('%s.tar.gz' % tarball, 'w:gz') + tar.add(tarball) + tar.close() + + shutil.move('%s.tar.gz' % tarball, '/mit/macathena/dist/') + shutil.rmtree('/mit/macathena/build/%s' % tarball) + + print 'Created /mit/macathena/dist/%s.tar.gz' % tarball def packageCvs(module, cvsModule, extras=['packs/build/autoconf'], cvsroot='/afs/dev.mit.edu/source/repository', date='tomorrow'): @@ -47,16 +81,16 @@ print 'Created /mit/macathena/dist/%s.tar.gz' % tarball -modules = {'moira': ['moira', False, '/afs/athena.mit.edu/astaff/project/moiradev/repository'], - 'libathdir': ['athena/lib/athdir'], - 'athdir': ['athena/bin/athdir'], - 'machtype': ['athena/bin/machtype'], - 'attachandrun': ['athena/bin/attachandrun'], - 'athrun': ['athena/bin/athrun'], - 'athinfo': ['athena/bin/athinfo'], - 'getcluster': ['athena/bin/getcluster', ['packs/build/autoconf', 'packs/build/aclocal.m4']], - 'libxj': ['athena/lib/Xj'], - 'libss': ['athena/lib/ss', ['packs/build/autoconf', 'packs/build/aclocal.m4', 'packs/build/libtool']], - 'xcluster': ['athena/bin/xcluster', ['packs/build/autoconf', 'packs/build/aclocal.m4']], - 'discuss': ['athena/bin/discuss']} +cvsModules = {'moira': ['moira', False, '/afs/athena.mit.edu/astaff/project/moiradev/repository']} + +svnModules = {'libathdir': ['trunk/athena/lib/athdir'], + 'athdir': ['trunk/athena/bin/athdir'], + 'machtype': ['trunk/athena/bin/machtype'], + 'attachandrun': ['trunk/athena/bin/attachandrun'], + 'athrun': ['trunk/athena/bin/athrun'], + 'athinfo': ['trunk/athena/bin/athinfo'], + 'getcluster': ['trunk/athena/bin/getcluster', ['attic/packs/build/aclocal.m4']], + 'libxj': ['trunk/athena/lib/Xj'], + 'xcluster': ['trunk/athena/bin/xcluster', ['attic/packs/build/aclocal.m4']], + 'discuss': ['trunk/athena/bin/discuss']} if __name__ == '__main__': @@ -64,11 +98,13 @@ if sys.argv[1] == "all": - build = modules.keys() + build = cvsModules.keys() + svnModules.keys() else: build = sys.argv[1:] for arg in build: - if modules.has_key(arg): - apply(packageCvs, [arg] + modules[arg]) + if svnModules.has_key(arg): + apply(packageSvn, [arg] + svnModules[arg]) + elif cvsModules.has_key(arg): + apply(packageCvs, [arg] + cvsModules[arg]) else: print "Sorry - I don't know about the module %s" % arg