chrome/installer/mac/signing/notarize.py
def wait_for_results(uuids, config):
    """Waits for results from the notarization service. This iterates the list
    of UUIDs and checks the status of each one. For each successful result, the
    function yields to the caller. If a request failed, this raises a
    NotarizationError. If no requests are ready, this operation blocks and
    retries until a result is ready. After a certain amount of time, the
    operation will time out with a NotarizationError if no results are
    produced.

    Args:
        uuids: List of UUIDs to check for results. The list must not be empty.
        config: The |config.CodeSignConfig| object.

    Yields:
        The UUID of a successful notarization request.
    """
    assert len(uuids)

    wait_set = set(uuids)

    sleep_time_seconds = 5
    total_sleep_time_seconds = 0

    while len(wait_set) > 0:
        for uuid in list(wait_set):
            try:
                command = [
                    'xcrun', 'altool', '--notarization-info', uuid,
                    '--username', config.notary_user, '--password',
                    config.notary_password, '--output-format', 'xml'
                ]
                if config.notary_asc_provider is not None:
                    command.extend(
                        ['--asc-provider', config.notary_asc_provider])
                output = commands.run_command_output(command)
            except subprocess.CalledProcessError as e:
                # A notarization request might report as "not found" immediately
                # after submission, which causes altool to exit non-zero. Check
                # for this case and parse the XML output to ensure that the
                # error code refers to the not-found state. The UUID is known-
                # good since it was a result of submit(), so loop to wait for
                # it to show up.
                if e.returncode == 239:
                    plist = plistlib.loads(e.output)
                    if plist['product-errors'][0]['code'] == 1519:
                        continue
                # Sometimes there are network hiccups when fetching notarization
                # info, but that often fixes itself and shouldn't derail the
                # entire signing operation. More serious extended connectivity
                # problems will eventually fall through to the "no results"
                # timeout.
                if e.returncode == 13:
                    logger.warning(e.output)
                    continue
                # And other times the command exits with code 1 and no further
                # output.
                if e.returncode == 1:
                    logger.warning(e.output)
                    continue
                raise e

            plist = plistlib.loads(output)
            info = plist['notarization-info']
            status = info['Status']
            if status == 'in progress':
                continue
            elif status == 'success':
                logger.info('Successfully notarized request %s. Log file: %s',
                            uuid, info[_LOG_FILE_URL])
                wait_set.remove(uuid)
                yield uuid
            else:
                logger.error(
                    'Failed to notarize request %s. Log file: %s. Output:\n%s',
                    uuid, info[_LOG_FILE_URL], output)
                raise NotarizationError(
                    'Notarization request {} failed with status: "{}". '
                    'Log file: {}.'.format(uuid, status, info[_LOG_FILE_URL]))

        if len(wait_set) > 0:
            # Do not wait more than 60 minutes for all the operations to
            # complete.
            if total_sleep_time_seconds < 60 * 60:
                # No results were available, so wait and try again in some
                # number of seconds. Do not wait more than 1 minute for any
                # iteration.
                time.sleep(sleep_time_seconds)
                total_sleep_time_seconds += sleep_time_seconds
                sleep_time_seconds = min(sleep_time_seconds * 2, 60)
            else:
                raise NotarizationError(
                    'Timed out waiting for notarization requests: {}'.format(
                        wait_set))
Waits for results from the notarization service. This iterates the list
    of UUIDs and checks the status of each one. For each successful result, the
    function yields to the caller. If a request failed, this raises a
    NotarizationError. If no requests are ready, this operation blocks and
    retries until a result is ready. After a certain amount of time, the
    operation will time out with a NotarizationError if no results are
    produced.

    Args:
        uuids: List of UUIDs to check for results. The list must not be empty.
        config: The |config.CodeSignConfig| object.

    Yields:
        The UUID of a successful notarization request.
    
Waits for results from the notarization service. This iterates the list
of UUIDs and checks the status of each one. For each successful result, the
function yields to the caller. If a request failed, this raises a
NotarizationError. If no requests are ready, this operation blocks and
retries until a result is ready. After a certain amount of time, the
operation will time out with a NotarizationError if no results are
produced.
Waits for results from the notarization service . This iterates the list of UUIDs and checks the status of each one . For each successful result the function yields to the caller . If a request failed this raises a NotarizationError . If no requests are ready this operation blocks and retries until a result is ready . After a certain amount of time the operation will time out with a NotarizationError if no results are produced .
def wait_for_results(uuids, config):
    assert len(uuids)
    wait_set = set(uuids)
    sleep_time_seconds = 5
    total_sleep_time_seconds = 0
    while len(wait_set) > 0:
        for uuid in list(wait_set):
            try:
                command = [
                    'xcrun', 'altool', '--notarization-info', uuid,
                    '--username', config.notary_user, '--password',
                    config.notary_password, '--output-format', 'xml'
                ]
                if config.notary_asc_provider is not None:
                    command.extend(
                        ['--asc-provider', config.notary_asc_provider])
                output = commands.run_command_output(command)
            except subprocess.CalledProcessError as e:
                if e.returncode == 239:
                    plist = plistlib.loads(e.output)
                    if plist['product-errors'][0]['code'] == 1519:
                        continue
                if e.returncode == 13:
                    logger.warning(e.output)
                    continue
                if e.returncode == 1:
                    logger.warning(e.output)
                    continue
                raise e
            plist = plistlib.loads(output)
            info = plist['notarization-info']
            status = info['Status']
            if status == 'in progress':
                continue
            elif status == 'success':
                logger.info('Successfully notarized request %s. Log file: %s',
                            uuid, info[_LOG_FILE_URL])
                wait_set.remove(uuid)
                yield uuid
            else:
                logger.error(
                    'Failed to notarize request %s. Log file: %s. Output:\n%s',
                    uuid, info[_LOG_FILE_URL], output)
                raise NotarizationError(
                    'Notarization request {} failed with status: "{}". '
                    'Log file: {}.'.format(uuid, status, info[_LOG_FILE_URL]))
        if len(wait_set) > 0:
            if total_sleep_time_seconds < 60 * 60:
                time.sleep(sleep_time_seconds)
                total_sleep_time_seconds += sleep_time_seconds
                sleep_time_seconds = min(sleep_time_seconds * 2, 60)
            else:
                raise NotarizationError(
                    'Timed out waiting for notarization requests: {}'.format(
                        wait_set))
def wait_for_results ( uuids , config ) : assert len ( uuids ) wait_set = set ( uuids ) sleep_time_seconds = 5 total_sleep_time_seconds = 0 while len ( wait_set ) > 0 : for uuid in list ( wait_set ) : try : command = [ 'xcrun' , 'altool' , '--notarization-info' , uuid , '--username' , config . notary_user , '--password' , config . notary_password , '--output-format' , 'xml' ] if config . notary_asc_provider is not None : command . extend ( [ '--asc-provider' , config . notary_asc_provider ] ) output = commands . run_command_output ( command ) except subprocess . CalledProcessError as e : if e . returncode == 239 : plist = plistlib . loads ( e . output ) if plist [ 'product-errors' ] [ 0 ] [ 'code' ] == 1519 : continue if e . returncode == 13 : logger . warning ( e . output ) continue if e . returncode == 1 : logger . warning ( e . output ) continue raise e plist = plistlib . loads ( output ) info = plist [ 'notarization-info' ] status = info [ 'Status' ] if status == 'in progress' : continue elif status == 'success' : logger . info ( 'Successfully notarized request %s. Log file: %s' , uuid , info [ _LOG_FILE_URL ] ) wait_set . remove ( uuid ) yield uuid else : logger . error ( 'Failed to notarize request %s. Log file: %s. Output:\n%s' , uuid , info [ _LOG_FILE_URL ] , output ) raise NotarizationError ( 'Notarization request {} failed with status: "{}". ' 'Log file: {}.' . format ( uuid , status , info [ _LOG_FILE_URL ] ) ) if len ( wait_set ) > 0 : if total_sleep_time_seconds < 60 * 60 : time . sleep ( sleep_time_seconds ) total_sleep_time_seconds += sleep_time_seconds sleep_time_seconds = min ( sleep_time_seconds * 2 , 60 ) else : raise NotarizationError ( 'Timed out waiting for notarization requests: {}' . format ( wait_set ) )
Waits for results from the notarization service.
Waits for results from the notarization service .
"""Waits for results from the notarization service. This iterates the list
    of UUIDs and checks the status of each one. For each successful result, the
    function yields to the caller. If a request failed, this raises a
    NotarizationError. If no requests are ready, this operation blocks and
    retries until a result is ready. After a certain amount of time, the
    operation will time out with a NotarizationError if no results are
    produced.

    Args:
        uuids: List of UUIDs to check for results. The list must not be empty.
        config: The |config.CodeSignConfig| object.

    Yields:
        The UUID of a successful notarization request.
    """ # A notarization request might report as "not found" immediately # after submission, which causes altool to exit non-zero. Check # for this case and parse the XML output to ensure that the # error code refers to the not-found state. The UUID is known- # good since it was a result of submit(), so loop to wait for # it to show up. # Sometimes there are network hiccups when fetching notarization # info, but that often fixes itself and shouldn't derail the # entire signing operation. More serious extended connectivity # problems will eventually fall through to the "no results" # timeout. # And other times the command exits with code 1 and no further # output. # Do not wait more than 60 minutes for all the operations to # complete. # No results were available, so wait and try again in some # number of seconds. Do not wait more than 1 minute for any # iteration.
The UUID of a successful notarization request.
The UUID of a successful notarization request .
uuids
List of UUIDs to check for results. The list must not be empty.
List of UUIDs to check for results . The list must not be empty .
config
The |config.CodeSignConfig| object.
The |config . CodeSignConfig| object .