parameters: (infos)
docstring: Update the naclmono manifest with the newly built packages
docstring_summary: Update the naclmono manifest with the newly built packages
docstring_tokens: Update the naclmono manifest with the newly built packages
function: def update_mono_sdk_json(infos):
    '''Update the naclmono manifest with the newly built packages'''
    if len(infos) == 0:
      return
  
    manifest_file = open(MONO_MANIFEST, 'r')
    mono_manifest = json.loads(manifest_file.read())
    manifest_file.close()
  
    newbundles = {}
    for info in infos:
      bundle = {}
      bundle['name'] = info['naclmono_name']
      bundle['description'] = 'Mono for Native Client'
      bundle['stability'] = info['stability']
      bundle['recommended'] = 'no'
      bundle['version'] = 'experimental'
      archive = {}
      sha1_hash = hashlib.sha1()
      f = open(info['naclmono_name'] + '.bz2', 'rb')
      sha1_hash.update(f.read())
      archive['size'] = f.tell()
      f.close()
      archive['checksum'] = { 'sha1': sha1_hash.hexdigest() }
      archive['host_os'] = 'all'
      archive['url'] = ('https://commondatastorage.googleapis.com/'
                        'nativeclient-mirror/nacl/nacl_sdk/%s/%s/%s.bz2'
                        % (info['naclmono_name'], info['naclmono_rev'],
                          info['naclmono_name']))
      bundle['archives'] = [archive]
      bundle['revision'] = int(info['naclmono_rev'])
      bundle['sdk_revision'] = int(info['sdk_revision'])
  
      # Insert this new bundle into the manifest,
      # probably overwriting an existing bundle.
      for key, value in mono_manifest.items():
        if key == 'bundles':
          existing = filter(lambda b: b['name'] == info['naclmono_name'], value)
          if len(existing) > 0:
            loc = value.index(existing[0])
            value[loc] = bundle
          else:
            value.append(bundle)
      
    # Write out the file locally, then upload to its known location.
    manifest_file = open(MONO_MANIFEST, 'w')
    manifest_file.write(json.dumps(mono_manifest, sort_keys=False, indent=2))
    manifest_file.close()
    buildbot_common.Run([buildbot_common.GetGsutil(), 'cp', '-a', 'public-read',
        MONO_MANIFEST, GS_MANIFEST_PATH + MONO_MANIFEST])
function_tokens: def update_mono_sdk_json ( infos ) : if len ( infos ) == 0 : return manifest_file = open ( MONO_MANIFEST , 'r' ) mono_manifest = json . loads ( manifest_file . read ( ) ) manifest_file . close ( ) newbundles = { } for info in infos : bundle = { } bundle [ 'name' ] = info [ 'naclmono_name' ] bundle [ 'description' ] = 'Mono for Native Client' bundle [ 'stability' ] = info [ 'stability' ] bundle [ 'recommended' ] = 'no' bundle [ 'version' ] = 'experimental' archive = { } sha1_hash = hashlib . sha1 ( ) f = open ( info [ 'naclmono_name' ] + '.bz2' , 'rb' ) sha1_hash . update ( f . read ( ) ) archive [ 'size' ] = f . tell ( ) f . close ( ) archive [ 'checksum' ] = { 'sha1' : sha1_hash . hexdigest ( ) } archive [ 'host_os' ] = 'all' archive [ 'url' ] = ( 'https://commondatastorage.googleapis.com/' 'nativeclient-mirror/nacl/nacl_sdk/%s/%s/%s.bz2' % ( info [ 'naclmono_name' ] , info [ 'naclmono_rev' ] , info [ 'naclmono_name' ] ) ) bundle [ 'archives' ] = [ archive ] bundle [ 'revision' ] = int ( info [ 'naclmono_rev' ] ) bundle [ 'sdk_revision' ] = int ( info [ 'sdk_revision' ] ) # Insert this new bundle into the manifest, # probably overwriting an existing bundle. for key , value in mono_manifest . items ( ) : if key == 'bundles' : existing = filter ( lambda b : b [ 'name' ] == info [ 'naclmono_name' ] , value ) if len ( existing ) > 0 : loc = value . index ( existing [ 0 ] ) value [ loc ] = bundle else : value . append ( bundle ) # Write out the file locally, then upload to its known location. manifest_file = open ( MONO_MANIFEST , 'w' ) manifest_file . write ( json . dumps ( mono_manifest , sort_keys = False , indent = 2 ) ) manifest_file . close ( ) buildbot_common . Run ( [ buildbot_common . GetGsutil ( ) , 'cp' , '-a' , 'public-read' , MONO_MANIFEST , GS_MANIFEST_PATH + MONO_MANIFEST ] )