def build_proc_info(release, config_name, hostname, proc, port):
    """
    Return a dictionary with exhaustive metadata about a proc.  This is saved
    as the proc.yaml file that is given to the runner.
    """
    build = release.build
    app = build.app
    proc_info = {'release_hash': release.hash, 'config_name': config_name,
        'settings': release.config_yaml or {}, 'env': release.env_yaml or {
        }, 'version': build.tag, 'build_md5': build.file_md5, 'build_url':
        build.file.url, 'buildpack_url': build.buildpack_url,
        'buildpack_version': build.buildpack_version, 'app_name': app.name,
        'app_repo_url': app.repo_url, 'app_repo_type': app.repo_type,
        'host': hostname, 'proc_name': proc, 'port': port, 'user': release.
        run_as or 'nobody', 'group': 'nogroup', 'volumes': release.volumes or
        [], 'mem_limit': release.mem_limit, 'memsw_limit': release.memsw_limit}
    if build.os_image is not None:
        proc_info.update({'image_name': build.os_image.name, 'image_url':
            build.os_image.file.url, 'image_md5': build.os_image.file_md5})
    return proc_info
