Changeset 46

Show
Ignore:
Timestamp:
01/24/08 22:31:56 (16 years ago)
Author:
broder
Message:

Changed macathenaDist.py to use Athena 10 svn as upstream when possible

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/locker-bin/macathenaDist.py

    r35 r46  
    33import tarfile 
    44import os 
     5from os.path import basename 
    56import time 
    67import shutil 
     8 
     9mtime = 0 
    710 
    811class MyTarFile(tarfile.TarFile): 
     
    1417                 
    1518                if info.isdir(): 
    16                         info.mtime = 0 
     19                        info.mtime = mtime 
    1720                 
    1821                return info 
     22 
     23def packageSvn(module, svnModule, extras=[], svnroot='/afs/dev.mit.edu/source/svn-repos', revision='HEAD'): 
     24        os.system('attach macathena >/dev/null 2>/dev/null') 
     25        os.chdir('/mit/macathena/build') 
     26         
     27        os.system('svn export -r %s file://%s/%s %s >/dev/null 2>&1' % (revision, svnroot, svnModule, module)) 
     28         
     29        for extra in extras: 
     30                os.system('svn export -r %s file://%s/%s >/dev/null 2>&1' % (revision, svnroot, extra)) 
     31                os.system('mv %s %s' % (basename(extra), module)) 
     32         
     33        version_info = os.popen('svn info -r %s file://%s/%s' % (revision, svnroot, svnModule)).readlines() 
     34        for line in version_info: 
     35                if line.startswith('Last Changed Date: '): 
     36                        time_string = line.strip().split(': ')[1][0:19] 
     37                elif line.startswith('Last Changed Rev: '): 
     38                        revision = line.strip().split(': ')[1] 
     39         
     40        mtime = int(time.strftime("%s", time.strptime(time_string, "%Y-%m-%d %H:%M:%S"))) 
     41         
     42        tarball = "%s-%s" % (module, revision) 
     43        os.rename(module, tarball) 
     44         
     45        tar = MyTarFile.open('%s.tar.gz' % tarball, 'w:gz') 
     46        tar.add(tarball) 
     47        tar.close() 
     48         
     49        shutil.move('%s.tar.gz' % tarball, '/mit/macathena/dist/') 
     50        shutil.rmtree('/mit/macathena/build/%s' % tarball) 
     51         
     52        print 'Created /mit/macathena/dist/%s.tar.gz' % tarball 
    1953 
    2054def packageCvs(module, cvsModule, extras=['packs/build/autoconf'], cvsroot='/afs/dev.mit.edu/source/repository', date='tomorrow'): 
     
    4781        print 'Created /mit/macathena/dist/%s.tar.gz' % tarball 
    4882 
    49 modules = {'moira': ['moira', False, '/afs/athena.mit.edu/astaff/project/moiradev/repository'], 
    50         'libathdir': ['athena/lib/athdir'], 
    51        'athdir': ['athena/bin/athdir'], 
    52         'machtype': ['athena/bin/machtype'], 
    53         'attachandrun': ['athena/bin/attachandrun'], 
    54         'athrun': ['athena/bin/athrun'], 
    55         'athinfo': ['athena/bin/athinfo'], 
    56         'getcluster': ['athena/bin/getcluster', ['packs/build/autoconf', 'packs/build/aclocal.m4']], 
    57         'libxj': ['athena/lib/Xj'], 
    58         'libss': ['athena/lib/ss', ['packs/build/autoconf', 'packs/build/aclocal.m4', 'packs/build/libtool']], 
    59         'xcluster': ['athena/bin/xcluster', ['packs/build/autoconf', 'packs/build/aclocal.m4']], 
    60         'discuss': ['athena/bin/discuss']} 
     83cvsModules = {'moira': ['moira', False, '/afs/athena.mit.edu/astaff/project/moiradev/repository']} 
     84 
     85svnModules = {'libathdir': ['trunk/athena/lib/athdir'], 
     86        'athdir': ['trunk/athena/bin/athdir'], 
     87        'machtype': ['trunk/athena/bin/machtype'], 
     88        'attachandrun': ['trunk/athena/bin/attachandrun'], 
     89        'athrun': ['trunk/athena/bin/athrun'], 
     90        'athinfo': ['trunk/athena/bin/athinfo'], 
     91        'getcluster': ['trunk/athena/bin/getcluster', ['attic/packs/build/aclocal.m4']], 
     92        'libxj': ['trunk/athena/lib/Xj'], 
     93        'xcluster': ['trunk/athena/bin/xcluster', ['attic/packs/build/aclocal.m4']], 
     94        'discuss': ['trunk/athena/bin/discuss']} 
    6195 
    6296if __name__ == '__main__': 
     
    6498         
    6599        if sys.argv[1] == "all": 
    66                 build = modules.keys() 
     100                build = cvsModules.keys() + svnModules.keys() 
    67101        else: 
    68102                build = sys.argv[1:] 
    69103         
    70104        for arg in build: 
    71                 if modules.has_key(arg): 
    72                         apply(packageCvs, [arg] + modules[arg]) 
     105                if svnModules.has_key(arg): 
     106                        apply(packageSvn, [arg] + svnModules[arg]) 
     107                elif cvsModules.has_key(arg): 
     108                        apply(packageCvs, [arg] + cvsModules[arg]) 
    73109                else: 
    74110                        print "Sorry - I don't know about the module %s" % arg