build/fuchsia/binary_size_differ.py
def ComputePackageDiffs(before_blobs_file, after_blobs_file):
  '''Computes difference between after and before diff, for each package.'''
  before_blobs = GetPackageBlobsFromFile(before_blobs_file)
  after_blobs = GetPackageBlobsFromFile(after_blobs_file)

  assert before_blobs.keys() == after_blobs.keys(), (
      'Package files cannot'
      ' be compared with different packages: '
      '%s vs %s' % (before_blobs.keys(), after_blobs.keys()))

  growth = {'compressed': {}, 'uncompressed': {}}
  status_code = 0
  summary = ''
  for package_name in before_blobs:
    growth['compressed'][package_name] = (after_blobs[package_name].compressed -
                                          before_blobs[package_name].compressed)
    growth['uncompressed'][package_name] = (
        after_blobs[package_name].uncompressed -
        before_blobs[package_name].uncompressed)
    if growth['compressed'][package_name] > _MAX_DELTA_BYTES:
      if status_code == 1:
        summary = 'Failed! '
      status_code = 1
      summary += ('%s grew by %d bytes' %
                  (package_name, growth['compressed'][package_name]))

  growth['status_code'] = status_code
  growth['summary'] = summary

  # TODO(crbug.com/1266085): Investigate using these fields.
  growth['archive_filenames'] = []
  growth['links'] = []
  return growth
Computes difference between after and before diff, for each package.
Computes difference between after and before diff, for each package.
Computes difference between after and before diff for each package .
def ComputePackageDiffs(before_blobs_file, after_blobs_file):
  before_blobs = GetPackageBlobsFromFile(before_blobs_file)
  after_blobs = GetPackageBlobsFromFile(after_blobs_file)
  assert before_blobs.keys() == after_blobs.keys(), (
      'Package files cannot'
      ' be compared with different packages: '
      '%s vs %s' % (before_blobs.keys(), after_blobs.keys()))
  growth = {'compressed': {}, 'uncompressed': {}}
  status_code = 0
  summary = ''
  for package_name in before_blobs:
    growth['compressed'][package_name] = (after_blobs[package_name].compressed -
                                          before_blobs[package_name].compressed)
    growth['uncompressed'][package_name] = (
        after_blobs[package_name].uncompressed -
        before_blobs[package_name].uncompressed)
    if growth['compressed'][package_name] > _MAX_DELTA_BYTES:
      if status_code == 1:
        summary = 'Failed! '
      status_code = 1
      summary += ('%s grew by %d bytes' %
                  (package_name, growth['compressed'][package_name]))
  growth['status_code'] = status_code
  growth['summary'] = summary
  growth['archive_filenames'] = []
  growth['links'] = []
  return growth
def ComputePackageDiffs ( before_blobs_file , after_blobs_file ) : before_blobs = GetPackageBlobsFromFile ( before_blobs_file ) after_blobs = GetPackageBlobsFromFile ( after_blobs_file ) assert before_blobs . keys ( ) == after_blobs . keys ( ) , ( 'Package files cannot' ' be compared with different packages: ' '%s vs %s' % ( before_blobs . keys ( ) , after_blobs . keys ( ) ) ) growth = { 'compressed' : { } , 'uncompressed' : { } } status_code = 0 summary = '' for package_name in before_blobs : growth [ 'compressed' ] [ package_name ] = ( after_blobs [ package_name ] . compressed - before_blobs [ package_name ] . compressed ) growth [ 'uncompressed' ] [ package_name ] = ( after_blobs [ package_name ] . uncompressed - before_blobs [ package_name ] . uncompressed ) if growth [ 'compressed' ] [ package_name ] > _MAX_DELTA_BYTES : if status_code == 1 : summary = 'Failed! ' status_code = 1 summary += ( '%s grew by %d bytes' % ( package_name , growth [ 'compressed' ] [ package_name ] ) ) growth [ 'status_code' ] = status_code growth [ 'summary' ] = summary growth [ 'archive_filenames' ] = [ ] growth [ 'links' ] = [ ] return growth
Computes difference between after and before diff, for each package.
Computes difference between after and before diff for each package .
'''Computes difference between after and before diff, for each package.''' # TODO(crbug.com/1266085): Investigate using these fields.
before_blobs_file
after_blobs_file