Revision f873068a

View differences:

util/vm/build.py
54 54
Branch = None               # Branch to update and check out before testing
55 55
Zip = False                 # Archive .ovf and .vmdk into a .zip file
56 56
Forward = []                # VM port forwarding options (-redir)
57
Chown = ''                  # Build directory owner
57 58

  
58 59
VMImageDir = os.environ[ 'HOME' ] + '/vm-images'
59 60

  
......
774 775
       post: command line to run in VM after tests
775 776
       prompt: shell prompt (default '$ ')
776 777
       memory: memory size in MB"""
777
    global LogFile, Zip
778
    global LogFile, Zip, Chown
778 779
    start = time()
779 780
    lstart = localtime()
780 781
    date = strftime( '%y%m%d-%H-%M-%S', lstart)
781 782
    ovfdate = strftime( '%y%m%d', lstart )
782 783
    dir = 'mn-%s-%s' % ( flavor, date )
783 784
    if Branch:
784
        dir = 'mn-%s-%s-%s' % ( Branch, flavor, date )
785
        dirname = 'mn-%s-%s-%s' % ( Branch, flavor, date )
785 786
    try:
786
        os.mkdir( dir )
787
        os.mkdir( dir)
787 788
    except:
788 789
        raise Exception( "Failed to create build directory %s" % dir )
790
    if Chown:
791
        run( 'chown %s %s' % ( Chown, dir ) )
789 792
    os.chdir( dir )
790 793
    LogFile = open( 'build.log', 'w' )
791 794
    log( '* Logging to', abspath( LogFile.name ) )
......
935 938

  
936 939
def parseArgs():
937 940
    "Parse command line arguments and run"
938
    global LogToConsole, NoKVM, Branch, Zip, TIMEOUT, Forward
941
    global LogToConsole, NoKVM, Branch, Zip, TIMEOUT, Forward, Chown
939 942
    parser = argparse.ArgumentParser( description='Mininet VM build script',
940 943
                                      epilog=buildFlavorString() + ' ' +
941 944
                                      testString() )
......
975 978
                         help='output file for test image (vmdk)' )
976 979
    parser.add_argument( '-f', '--forward', default=[], action='append',
977 980
                         help='forward VM ports to local server, e.g. tcp:5555::22' )
981
    parser.add_argument( '-u', '--chown', metavar='user',
982
                         help='specify an owner for build directory' )
978 983
    args = parser.parse_args()
979 984
    if args.depend:
980 985
        depend()
......
996 1001
        Forward = args.forward
997 1002
    if not args.test and not args.run and not args.post:
998 1003
        args.test = [ 'sanity', 'core' ]
1004
    if args.chown:
1005
        Chown = args.chown
999 1006
    for flavor in args.flavor:
1000 1007
        if flavor not in isoURLs:
1001 1008
            print "Unknown build flavor:", flavor

Also available in: Unified diff