blob: b86f45d0a23bb4734468dd7a3637573499725362 [file] [log] [blame]
Brian O'Connor0fed5752015-05-04 18:15:29 -07001#!/usr/bin/env python
2# -----------------------------------------------------------------------------
3# Uploads ONOS distributable bits.
4# -----------------------------------------------------------------------------
5
6#FIXME need to export s3Creds
7
8import re
9from os import listdir
10from os.path import isfile, join
11
12from uploadToS3 import uploadFile
13
14nightlyTag = 'NIGHTLY'
15bitsPath = '/tmp'
16
17prefix = 'onos-(\d+\.\d+\.\d+)'
18buildNum = '\.?([\w-]*)'
19ext = '\.(?:tar\.gz|zip)'
20
21def findBits( path ):
22 for file in listdir( path ):
23 filePath = join( path, file )
24 if not isfile( filePath ):
25 continue
26
27 regex = prefix + buildNum + ext
28 match = re.match( regex, file )
29 if match:
30 version = match.group(1)
31 build = match.group(2)
32 if build:
Brian O'Connor30a412d2015-05-21 18:04:26 -070033 if 'NIGHTLY' in build or 'rc' in build:
Brian O'Connor0fed5752015-05-04 18:15:29 -070034 uploadFile(filePath, dest='nightly/')
35 else:
36 #no build; this is a release
37 uploadFile(filePath, dest='release/')
38
39if __name__ == '__main__':
Brian O'Connor30a412d2015-05-21 18:04:26 -070040 findBits( '/tmp' )