blob: 284a5097777fb2ed4bf9653d75862557a29db1e0 [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:
33 if 'NIGHTLY' in build:
34 uploadFile(filePath, dest='nightly/')
35 else:
36 #no build; this is a release
37 uploadFile(filePath, dest='release/')
38
39if __name__ == '__main__':
40 findBits( '/tmp' )