#NEWLINE# def main( ) : #NEWLINE# #INDENT# user = sh_str ( 'id -un' ) #NEWLINE# if ( user == 'root' ) : #NEWLINE# #INDENT# user = 'jkh' #NEWLINE# #UNINDENT# ref_date = 0 #NEWLINE# rel_dir = '' #NEWLINE# dirstring = e ( '${BE_ROOT}/release/${PRODUCT}' ) #NEWLINE# for x in glob . glob ( '{0}*' . format ( dirstring ) ) : #NEWLINE# #INDENT# if ( e ( '${BUILD_ARCH_SHORT}' ) not in os . listdir ( x ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if ( os . lstat ( x ) . st_ctime > ref_date ) : #NEWLINE# #INDENT# ref_date = os . lstat ( x ) . st_ctime #NEWLINE# rel_dir = x #NEWLINE# #UNINDENT# #UNINDENT# if ( not user ) : #NEWLINE# #INDENT# error ( 'Release not found' ) #NEWLINE# #UNINDENT# download_suffix = '' #NEWLINE# if ( e ( '${BUILD_TYPE}' ) . lower ( ) in [ 'master' , 'stable' ] ) : #NEWLINE# #INDENT# buildtimestamp = os . path . basename ( rel_dir ) . split ( '-' ) [ ( - 1 ) ] #NEWLINE# download_suffix = e ( '${BUILD_TYPE}/${buildtimestamp}' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# download_suffix = e ( '${BUILD_TYPE}' ) #NEWLINE# #UNINDENT# downloadtargetdir = e ( '${DOWNLOAD_PREFIX}/${download_suffix}' ) #NEWLINE# sh ( 'ssh ${user}@${DOWNLOAD_HOST} rm -rf ${downloadtargetdir}' ) #NEWLINE# sh ( 'ssh ${user}@${DOWNLOAD_HOST} mkdir -p ${downloadtargetdir}' ) #NEWLINE# sh ( 'scp -pr ${rel_dir}/* ${user}@${DOWNLOAD_HOST}:${downloadtargetdir}/' ) #NEWLINE# if ( e ( '${BUILD_TYPE}' ) . lower ( ) != 'master' ) : #NEWLINE# #INDENT# info ( 'Creating top level downloads symlink' ) #NEWLINE# sh ( 'ssh ${user}@${DOWNLOAD_HOST} ln -shf ${VERSION_NUMBER}/${download_suffix} ${DOWNLOAD_BASEDIR}/latest' ) #NEWLINE# info ( 'Creating MILESTONE level downloads symlink' ) #NEWLINE# sh ( 'ssh ${user}@${DOWNLOAD_HOST} ln -shf ${download_suffix} ${DOWNLOAD_PREFIX}/latest' ) #NEWLINE# #UNINDENT# info ( 'Synchronizing download server to CDN' ) #NEWLINE# sh ( 'ssh ${user}@${DOWNLOAD_HOST} /usr/local/sbin/rsync-mirror.sh' )