chrome/installer/mac/signing/pipeline.py
def _customize_and_sign_chrome(paths, dist_config, dest_dir, signed_frameworks):
    """Does channel customization and signing of a Chrome distribution. The
    resulting app bundle is moved into |dest_dir|.

    Args:
        paths: A |model.Paths| object.
        dist_config: A |config.CodeSignConfig| for the |model.Distribution|.
        dest_dir: The directory into which the product will be placed when
            the operations are completed.
        signed_frameworks: A dict that will store paths and change counts of
            already-signed inner frameworks keyed by bundle ID. Paths are used
            to recycle already-signed frameworks instead of re-signing them.
            Change counts are used to verify equivalence of frameworks when
            recycling them. Callers can pass an empty dict on the first call,
            and reuse the same dict for subsequent calls. This function will
            produce and consume entries in the dict. If this sharing is
            undesired, pass None instead of a dict.
    """
    # Copy the app to sign into the work dir.
    commands.copy_files(
        os.path.join(paths.input, dist_config.base_config.app_dir), paths.work)

    # Customize the app bundle.
    customization_dist = dist_config.distribution
    customization_dist_config = dist_config
    if not _include_branding_code_in_app(customization_dist):
        customization_dist = dist_config.distribution.brandless_copy()
        customization_dist_config = customization_dist.to_config(
            dist_config.base_config)

    modification.customize_distribution(paths, customization_dist,
                                        customization_dist_config)

    work_dir_framework_path = os.path.join(paths.work,
                                           dist_config.framework_dir)
    if signed_frameworks is not None and dist_config.base_bundle_id in signed_frameworks:
        # If the inner framework has already been modified and signed for this
        # bundle ID, recycle the existing signed copy without signing a new
        # copy. This ensures that bit-for-bit identical input will result in
        # bit-for-bit identical signatures not affected by differences in, for
        # example, the signature's timestamp. All variants of a product sharing
        # the same bundle ID are assumed to have bit-for-bit identical
        # frameworks.
        #
        # This is significant because of how binary diff updates work. Binary
        # diffs are built between two successive versions on the basis of their
        # inner frameworks being bit-for-bit identical without regard to any
        # customizations applied only to the outer app. In order for these to
        # apply to all installations regardless of the presence or specific
        # values of any app-level customizations, all inner frameworks for a
        # single version and base bundle ID must always remain bit-for-bit
        # identical, including their signatures.
        (signed_framework_path, signed_framework_change_count
        ) = signed_frameworks[dist_config.base_bundle_id]
        actual_framework_change_count = commands.copy_dir_overwrite_and_count_changes(
            os.path.join(dest_dir, signed_framework_path),
            work_dir_framework_path,
            dry_run=False)

        if actual_framework_change_count != signed_framework_change_count:
            raise ValueError(
                'While customizing and signing {} ({}), actual_framework_change_count {} != signed_framework_change_count {}'
                .format(dist_config.base_bundle_id,
                        dist_config.packaging_basename,
                        actual_framework_change_count,
                        signed_framework_change_count))

        parts.sign_chrome(paths, dist_config, sign_framework=False)
    else:
        unsigned_framework_path = os.path.join(paths.work,
                                               'modified_unsigned_framework')
        commands.copy_dir_overwrite_and_count_changes(
            work_dir_framework_path, unsigned_framework_path, dry_run=False)
        parts.sign_chrome(paths, dist_config, sign_framework=True)
        actual_framework_change_count = commands.copy_dir_overwrite_and_count_changes(
            work_dir_framework_path, unsigned_framework_path, dry_run=True)
        if signed_frameworks is not None:
            dest_dir_framework_path = os.path.join(dest_dir,
                                                   dist_config.framework_dir)
            signed_frameworks[dist_config.base_bundle_id] = (
                dest_dir_framework_path, actual_framework_change_count)

    app_path = os.path.join(paths.work, dist_config.app_dir)
    commands.make_dir(dest_dir)
    commands.move_file(app_path, os.path.join(dest_dir, dist_config.app_dir))
Does channel customization and signing of a Chrome distribution. The
    resulting app bundle is moved into |dest_dir|.

    Args:
        paths: A |model.Paths| object.
        dist_config: A |config.CodeSignConfig| for the |model.Distribution|.
        dest_dir: The directory into which the product will be placed when
            the operations are completed.
        signed_frameworks: A dict that will store paths and change counts of
            already-signed inner frameworks keyed by bundle ID. Paths are used
            to recycle already-signed frameworks instead of re-signing them.
            Change counts are used to verify equivalence of frameworks when
            recycling them. Callers can pass an empty dict on the first call,
            and reuse the same dict for subsequent calls. This function will
            produce and consume entries in the dict. If this sharing is
            undesired, pass None instead of a dict.
    
Does channel customization and signing of a Chrome distribution. The
resulting app bundle is moved into |dest_dir|.
Does channel customization and signing of a Chrome distribution . The resulting app bundle is moved into |dest_dir| .
def _customize_and_sign_chrome(paths, dist_config, dest_dir, signed_frameworks):
    commands.copy_files(
        os.path.join(paths.input, dist_config.base_config.app_dir), paths.work)
    customization_dist = dist_config.distribution
    customization_dist_config = dist_config
    if not _include_branding_code_in_app(customization_dist):
        customization_dist = dist_config.distribution.brandless_copy()
        customization_dist_config = customization_dist.to_config(
            dist_config.base_config)
    modification.customize_distribution(paths, customization_dist,
                                        customization_dist_config)
    work_dir_framework_path = os.path.join(paths.work,
                                           dist_config.framework_dir)
    if signed_frameworks is not None and dist_config.base_bundle_id in signed_frameworks:
         This is significant because of how binary diff updates work. Binary
         diffs are built between two successive versions on the basis of their
         inner frameworks being bit-for-bit identical without regard to any
         customizations applied only to the outer app. In order for these to
         apply to all installations regardless of the presence or specific
         values of any app-level customizations, all inner frameworks for a
         single version and base bundle ID must always remain bit-for-bit
         identical, including their signatures.
        (signed_framework_path, signed_framework_change_count
        ) = signed_frameworks[dist_config.base_bundle_id]
        actual_framework_change_count = commands.copy_dir_overwrite_and_count_changes(
            os.path.join(dest_dir, signed_framework_path),
            work_dir_framework_path,
            dry_run=False)
        if actual_framework_change_count != signed_framework_change_count:
            raise ValueError(
                'While customizing and signing {} ({}), actual_framework_change_count {} != signed_framework_change_count {}'
                .format(dist_config.base_bundle_id,
                        dist_config.packaging_basename,
                        actual_framework_change_count,
                        signed_framework_change_count))
        parts.sign_chrome(paths, dist_config, sign_framework=False)
    else:
        unsigned_framework_path = os.path.join(paths.work,
                                               'modified_unsigned_framework')
        commands.copy_dir_overwrite_and_count_changes(
            work_dir_framework_path, unsigned_framework_path, dry_run=False)
        parts.sign_chrome(paths, dist_config, sign_framework=True)
        actual_framework_change_count = commands.copy_dir_overwrite_and_count_changes(
            work_dir_framework_path, unsigned_framework_path, dry_run=True)
        if signed_frameworks is not None:
            dest_dir_framework_path = os.path.join(dest_dir,
                                                   dist_config.framework_dir)
            signed_frameworks[dist_config.base_bundle_id] = (
                dest_dir_framework_path, actual_framework_change_count)
    app_path = os.path.join(paths.work, dist_config.app_dir)
    commands.make_dir(dest_dir)
    commands.move_file(app_path, os.path.join(dest_dir, dist_config.app_dir))
def _customize_and_sign_chrome ( paths , dist_config , dest_dir , signed_frameworks ) : commands . copy_files ( os . path . join ( paths . input , dist_config . base_config . app_dir ) , paths . work ) customization_dist = dist_config . distribution customization_dist_config = dist_config if not _include_branding_code_in_app ( customization_dist ) : customization_dist = dist_config . distribution . brandless_copy ( ) customization_dist_config = customization_dist . to_config ( dist_config . base_config ) modification . customize_distribution ( paths , customization_dist , customization_dist_config ) work_dir_framework_path = os . path . join ( paths . work , dist_config . framework_dir ) if signed_frameworks is not None and dist_config . base_bundle_id in signed_frameworks : ( signed_framework_path , signed_framework_change_count ) = signed_frameworks [ dist_config . base_bundle_id ] actual_framework_change_count = commands . copy_dir_overwrite_and_count_changes ( os . path . join ( dest_dir , signed_framework_path ) , work_dir_framework_path , dry_run = False ) if actual_framework_change_count != signed_framework_change_count : raise ValueError ( 'While customizing and signing {} ({}), actual_framework_change_count {} != signed_framework_change_count {}' . format ( dist_config . base_bundle_id , dist_config . packaging_basename , actual_framework_change_count , signed_framework_change_count ) ) parts . sign_chrome ( paths , dist_config , sign_framework = False ) else : unsigned_framework_path = os . path . join ( paths . work , 'modified_unsigned_framework' ) commands . copy_dir_overwrite_and_count_changes ( work_dir_framework_path , unsigned_framework_path , dry_run = False ) parts . sign_chrome ( paths , dist_config , sign_framework = True ) actual_framework_change_count = commands . copy_dir_overwrite_and_count_changes ( work_dir_framework_path , unsigned_framework_path , dry_run = True ) if signed_frameworks is not None : dest_dir_framework_path = os . path . join ( dest_dir , dist_config . framework_dir ) signed_frameworks [ dist_config . base_bundle_id ] = ( dest_dir_framework_path , actual_framework_change_count ) app_path = os . path . join ( paths . work , dist_config . app_dir ) commands . make_dir ( dest_dir ) commands . move_file ( app_path , os . path . join ( dest_dir , dist_config . app_dir ) )
Does channel customization and signing of a Chrome distribution.
Does channel customization and signing of a Chrome distribution .
"""Does channel customization and signing of a Chrome distribution. The
    resulting app bundle is moved into |dest_dir|.

    Args:
        paths: A |model.Paths| object.
        dist_config: A |config.CodeSignConfig| for the |model.Distribution|.
        dest_dir: The directory into which the product will be placed when
            the operations are completed.
        signed_frameworks: A dict that will store paths and change counts of
            already-signed inner frameworks keyed by bundle ID. Paths are used
            to recycle already-signed frameworks instead of re-signing them.
            Change counts are used to verify equivalence of frameworks when
            recycling them. Callers can pass an empty dict on the first call,
            and reuse the same dict for subsequent calls. This function will
            produce and consume entries in the dict. If this sharing is
            undesired, pass None instead of a dict.
    """ # Copy the app to sign into the work dir. # Customize the app bundle. # If the inner framework has already been modified and signed for this # bundle ID, recycle the existing signed copy without signing a new # copy. This ensures that bit-for-bit identical input will result in # bit-for-bit identical signatures not affected by differences in, for # example, the signature's timestamp. All variants of a product sharing # the same bundle ID are assumed to have bit-for-bit identical # frameworks. # # This is significant because of how binary diff updates work. Binary # diffs are built between two successive versions on the basis of their # inner frameworks being bit-for-bit identical without regard to any # customizations applied only to the outer app. In order for these to # apply to all installations regardless of the presence or specific # values of any app-level customizations, all inner frameworks for a # single version and base bundle ID must always remain bit-for-bit # identical, including their signatures.
paths
A |model.Paths| object.
A |model . Paths| object .
dist_config
A |config.CodeSignConfig| for the |model.Distribution|.
A |config . CodeSignConfig| for the |model . Distribution| .
dest_dir
The directory into which the product will be placed when
the operations are completed.
The directory into which the product will be placed when the operations are completed .
signed_frameworks
A dict that will store paths and change counts of
already-signed inner frameworks keyed by bundle ID. Paths are used
to recycle already-signed frameworks instead of re-signing them.
Change counts are used to verify equivalence of frameworks when
recycling them. Callers can pass an empty dict on the first call,
and reuse the same dict for subsequent calls. This function will
produce and consume entries in the dict. If this sharing is
undesired, pass None instead of a dict.
A dict that will store paths and change counts of already - signed inner frameworks keyed by bundle ID . Paths are used to recycle already - signed frameworks instead of re - signing them . Change counts are used to verify equivalence of frameworks when recycling them . Callers can pass an empty dict on the first call and reuse the same dict for subsequent calls . This function will produce and consume entries in the dict . If this sharing is undesired pass None instead of a dict .